/*

* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Smart-Shop开源商城系统/ Java商城-首选电商平台系统 请务必保留此注释头信息
* |     开源地址: https://gitee.com/ningbo-qishan/gruul-mall
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     可正常分享和学习源码,未经授权 不可商用！
* |     商业版中台购买/开源版商业授权 联系技术客服
* |     官网:  https://www.73app.cn/
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Copyright (c) 2016-2999 宁波启山智软科技有限公司
* |     版权所有 ,侵权必究！
* ------------------------------------------------------------------------

*/
package com.medusa.gruul.discount.web.controller.api;


import com.medusa.gruul.common.core.annotation.EscapeLogin;
import com.medusa.gruul.common.core.util.Result;
import com.medusa.gruul.discount.api.model.vo.api.ApiCouponVo;
import com.medusa.gruul.discount.service.api.IApiCouponService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 小程序优惠劵 前端控制器
 * </p>
 *
 * @author lcysike
 * @since 2019-12-09
 */
@RestController
@RequestMapping("/api/coupon")
public class ApiCouponController {

    @Autowired
    private IApiCouponService apiCouponService;

    /**
     * 优惠劵信息列表
     */
    @GetMapping("/list")
    @EscapeLogin
    @ApiOperation(value = "优惠劵信息列表")
    public Result<List<ApiCouponVo>> getApiCouponList() {
        List<ApiCouponVo> apiCouponVos = apiCouponService.getApiCouponList();
        return Result.ok(apiCouponVos);
    }

    /**
     * 优惠劵组件信息列表
     */
    @GetMapping("/component/list")
    @EscapeLogin
    @ApiOperation(value = "优惠劵组件信息列表")
    public Result<List<ApiCouponVo>> getApiCouponComponentList() {
        List<ApiCouponVo> apiCouponVos = apiCouponService.getApiCouponComponentList();
        return Result.ok(apiCouponVos);
    }

    /**
     * 购物车优惠劵信息列表
     */
    @GetMapping("/shopping/cart/list")
    @ApiOperation(value = "购物车优惠劵信息列表")
    public Result<List<ApiCouponVo>> getApiShoppingCartCouponList() {
        List<ApiCouponVo> apiCouponVos = apiCouponService.getApiShoppingCartCouponList();
        return Result.ok(apiCouponVos);
    }

    /**
     * 积分优惠劵信息列表
     */
    @GetMapping("/integral/list")
    @ApiOperation(value = "积分优惠劵信息列表")
    public Result<List<ApiCouponVo>> getApiIntegralCouponList() {
        List<ApiCouponVo> apiCouponVos = apiCouponService.getApiIntegralCouponList();
        return Result.ok(apiCouponVos);
    }
}
